<?php

use Illuminate\Support\Facades\Schema;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;

class CreateUsersTable extends Migration
{
    /**
     * Run the migrations.
     *
     * @return void
     */
    public function up()
    {
        Schema::create('users', function (Blueprint $table) {
            $table->increments('id');
            $table->string('name')->default('')->comment('真实姓名')->index();
            $table->string('email')->default('')->index();
            $table->string('phone')->default('')->index();
            $table->string('password')->default('');
            $table->string('nickname')->default('')->index();
            $table->string('avatar')->default('');
            $table->tinyInteger('gender')->default(0);
            $table->string('province')->default('');
            $table->string('city')->default('');
            $table->string('country')->default('');
            $table->integer('scores')->default(0)->comment('积分');
            $table->softDeletes();
            $table->timestamps();

            $table->index('updated_at');
        });
        \DB::statement("ALTER TABLE `users` comment '前端用户表'");
    }

    /**
     * Reverse the migrations.
     *
     * @return void
     */
    public function down()
    {
        Schema::dropIfExists('users');
    }
}
